[ci] set github CI (#229)
authorwoclass <git@wo-class.cn>
Fri, 17 Dec 2021 01:52:05 +0000 (19:52 -0600)
committerGitHub <noreply@github.com>
Fri, 17 Dec 2021 01:52:05 +0000 (20:52 -0500)
* [ci] set github CI: ubuntu, windows, macOS

* [ci] add make.yml

* [ci] Skip macOS check MANIFEST temporary

.github/workflows/cmake.yml [new file with mode: 0644]
.github/workflows/make.yml [new file with mode: 0644]

diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml
new file mode 100644 (file)
index 0000000..2881440
--- /dev/null
@@ -0,0 +1,64 @@
+name: CMake
+
+on:
+  push:
+    branches:
+      - master
+      - 'release-*'
+  pull_request:
+  # run on all pr
+
+jobs:
+  build:
+    strategy:
+      matrix:
+        os: [ubuntu-latest, windows-latest, macOS-latest]
+        shared: ["ON", "OFF"]
+    runs-on: ${{ matrix.os }}
+    name: ${{ matrix.os }} - shared=${{ matrix.shared }}
+    steps:
+    - uses: actions/checkout@v2
+    - name: Build
+      run: |
+        mkdir build
+        cmake -S . -B build -DBUILD_SHARED_LIBS=${{ matrix.shared }} -DUTF8PROC_ENABLE_TESTING=ON
+        cmake --build build
+    - name: Run Test
+      run: ctest --test-dir build -V
+    - name: Upload shared lib
+      if: matrix.shared == 'ON'
+      uses: actions/upload-artifact@v2
+      with:
+        name: ${{ matrix.os }}
+        path: |
+          build/libutf8proc.*
+          build/Debug/utf8proc.*
+
+  mingw:
+    strategy:
+      matrix:
+        os: [windows-latest]
+        shared: ["ON", "OFF"]
+    runs-on: ${{ matrix.os }}
+    name: mingw64 - shared=${{ matrix.shared }}
+    defaults:
+      run:
+        shell: msys2 {0}
+    steps:
+    - uses: actions/checkout@v2
+    - uses: msys2/setup-msys2@v2
+      with:
+        install: gcc make mingw-w64-x86_64-cmake
+    - name: Build
+      run: |
+        mkdir build
+        cmake -S . -B build -DBUILD_SHARED_LIBS=${{ matrix.shared }} -DUTF8PROC_ENABLE_TESTING=ON -G'MSYS Makefiles'
+        cmake --build build
+    - name: Run Test
+      run: ctest --test-dir build -V
+    - name: Upload shared lib
+      if: matrix.shared == 'ON'
+      uses: actions/upload-artifact@v2
+      with:
+        name: windows-mingw64
+        path: build/libutf8proc.*
diff --git a/.github/workflows/make.yml b/.github/workflows/make.yml
new file mode 100644 (file)
index 0000000..1ee2299
--- /dev/null
@@ -0,0 +1,41 @@
+name: Make
+
+on:
+  push:
+    branches:
+      - master
+      - 'release-*'
+  pull_request:
+  # run on all pr
+
+jobs:
+  build:
+    strategy:
+      matrix:
+        os: [ubuntu-latest, macOS-latest]
+    runs-on: ${{ matrix.os }}
+    name: ${{ matrix.os }}
+    steps:
+    - uses: actions/checkout@v2
+    # TODO: update makefile to check MANIFEST
+    # - name: Install dependencies (MacOS)
+    #   if: matrix.config.os == 'macos-latest'
+    #   run: brew install ruby findutils
+
+    - name: Check MANIFEST
+      if: matrix.config.os == 'ubuntu-latest'
+      run: make manifest && diff MANIFEST.new MANIFEST
+    - name: Run Test
+      run: make check
+    - name: Check utf8proc_data.c
+      run: make data && diff data/utf8proc_data.c.new utf8proc_data.c
+    - name: Clean
+      run: make clean && git status --ignored --porcelain && test -z "$(git status --ignored --porcelain)"
+
+    - name: Make lib
+      run: make
+    - name: Upload shared lib
+      uses: actions/upload-artifact@v2
+      with:
+        name: make-${{ matrix.os }}
+        path: libutf8proc.*